import React, { useEffect, useState } from 'react';
import axios from 'axios';
import Heand from '../../component/heand';
import { useNavigate } from "react-router-dom";
import { Input, Button } from 'antd';

function Add_newdoor_pctext() {
  const [textone,setTextone]=useState('')
  const [texttwo,setTexttwo]=useState('')
  const [textthree,setTextthree]=useState('')
   
   const handleNameChangeone = (event)=>{
    setTextone(event.target.value)
   }
   const handleNameChangetwo = (event)=>{
    setTexttwo(event.target.value)
   }
   const handleNameChangethree = (event)=>{
    setTextthree(event.target.value)
   }
  
   
const handleSubmit= async()=>{
    try {
        const response = await axios.put(`https://r5ctn9z9.lc-cn-n1-shared.com/1.1/classes/pctext/${'6582a964841d0562c81481bc'}`, {
            textone:textone,
            texttwo:texttwo,
            textthree:textthree
        }, {
            headers: {
                " X-LC-Id": "r5CTN9z96pCW8mI8fx9YxOmw-gzGzoHsz",
                "X-LC-Key": "8gSsl4Sz0ILMiQeMNMA8xQqg",
                'Content-Type': 'application/json'
            }
        }).then((e) => {
            console.log(e.data); // 处理返回的数据
            //   setShowInput(false);

            window.location.reload()

          


            // 更新展示的数据
        })


    } catch (error) {
        console.error(error);
    }
}
  
  return (

    <div className='pushinput'>
      <Heand />

      <form className='pushtj' >
        <div>
          <label htmlFor="name">简介一：</label>
          <Input className="xqinp" type="text" id="name" value={textone} onChange={handleNameChangeone} />
        </div>
       
        <div>
          <label htmlFor="name">简介二：</label>
          <Input className="xqinp" type="text" id="name" value={texttwo} onChange={handleNameChangetwo} />
        </div>
        <div>
          <label htmlFor="name">简介三：</label>
          <Input className="xqinp" type="text" id="name" value={textthree} onChange={handleNameChangethree} />
        </div>
       

        <Button onClick={handleSubmit} >添加商品</Button>
      </form>
    </div>
  )
}

export default Add_newdoor_pctext;